package com.yc.app1;

import java.util.Map;
import java.util.Properties;
import java.util.Set;

/**
 * Company 源辰信息
 *
 * @author navy
 * @date 2024/10/26
 * Email haijunzhou@hnit.edu.cn
 */
public class Demo1 {

    public static void main(String[] args) {
        System.out.println("Math.E = " + Math.E);
        System.out.println("Math.PI = " + Math.PI);

        System.out.println("Math.min(5,7) = " + Math.min(5, 7));
        System.out.println("Math.max(5,7) = " + Math.max(5, 7));

        System.out.println("Math.ceil(3.14) = " + Math.ceil(3.14));
        System.out.println("Math.floor(3.14) = " + Math.floor(3.14));
        System.out.println("Math.round(3.14) = " + Math.round(3.14));

        // 0~100
        double r = Math.random(); // 0 < r < 1
        int i = (int) (r * 101);
        System.out.println("i = " + i);

        System.err.println("这是一段错误信息");

        // 集合
        Properties properties = System.getProperties();
        Set<Map.Entry<Object, Object>> entries = properties.entrySet();
        for (Map.Entry<Object, Object> entry : entries) {
            Object key = entry.getKey();
            Object value = entry.getValue();
            System.out.printf(" %s = %s \n", key, value);
        }

        System.out.println("用户目录:" + System.getProperty("user.dir"));
        System.out.println("自定义属性:" + System.getProperty("自定义属性"));
        System.out.println("自定义属性:" + System.getProperty("自定义属性", "test"));

        int[] arr1 = {1,2,3,4,5,6,7};
        int[] arr2 = {9,8,7,6};
        // 9 4 3 6
        System.arraycopy(arr1,2, arr2, 1, 2);

        for (int i1 = 0; i1 < arr2.length; i1++) {
            System.out.println("arr2[i1] = " + arr2[i1]);
        }


    }
}
